
class Mappable
{
protected:
	// absolute map positioning
	long long m_x;
	long long m_y;

public:
	void GetMapPos(long long *x, long long *y)
	{
		*x = m_x;
		*y = m_y;
	}

	void SetMapPos(long long x, long long y)
	{
		m_x = x;
		m_y = y;
	}
};

class Drawable : Mappable
{
private:

public:
	// draw the object at its position
	virtual void Draw();

	// draw only the part of the object
	// contained in the specified mapped rectangle:
	//
	// (x1, y1)
	//   +-----------------+
	//   |                 |
	//   +-----------------+
	//                  (x2, y2)
	virtual void Draw(long long x1, long long y1, long long x2, long long y2);

};


// Base view/camera class
// - view centers around Mappable position
class View : Mappable
{
protected:

	// dimensions of view
	int m_view_w;
	int m_view_h;

	// additional parameters
	int m_view_rot;
	float m_view_zoom;

public:

	View(int w, int h, int rot, float zoom)
	: m_view_w(w), m_view_h(h), m_view_rot(rot), m_view_zoom(zoom)
	{

	}

	~View()
	{

	}

	// set up the view with an absolute position, rotation, zoom, etc
	void SetView(long long x, long long y, int w, int h, int rot, float zoom);

	// move the screen view area
	void Move(long long up, long long left);	// modify variables to correspond correctly to +/- signs

};

class ScrollableView : View
{
private:


protected:
	// vertical/horizontal offsets from center
	// after which we start to scroll
	int m_scroll_y_offset;
	int m_scroll_x_offset;

	// todo: consider implementing scroll-box dimensions as a percentage of the view area?

public:
	ScrollableView();

	~ScrollableView();

	// set a bounding box for the no-scroll zone.
	// If the player moves out of this region, the view automatically moves (scrolls) to contain them.
	void SetScrollBox(int x_offset, int y_offset);

	// follow the rabbit
	// don't let it move out of the scroll-box
	// (adjust the view position (follow) to achieve this)
	void Follow(Mappable rabbit);
};

// Game Object Class
//
// Base Drawable Object Representation
// = basic operations we want to perform
//   on every drawable object 
//
// - drawable
// - handle by an object center
// - absolute positioning on map system
// 		- moveable
// - collision detection
// - 
//
// Does NOT cover 'update' functions
// these would presumably be part of 
// some specific derived object
class GameObj
{
private:
	
	// internal map positioning representation
	int x_tile;		// which tile are we on
	int y_tile;
	int x_offset;	// offset from tile origin (specific)
	int y_offset;
	

public:
	
	// move up, left relative amount
	// rotation, x and y scaling (zoom)
	void MoveRelative(int up, int left, float rot, float x_scale, float y_scale);

	
	// x and y are absolute positions wrt tile map
	void MoveAbsolute(long long x, long long y, float rot, float x_scale, float y_scale);
	
	// todo
	void CheckCollisions();

	// todo
	virtual void Draw();
	
	
	// todo - how to handle wrt Draw?
	void SetObjHandle(int x, int y);
	

};

/**************************
Tile Map

		  1   2   3   4		- X
		+---+---+---+---+
	1	|   |   |   |   |
		+---+---+---+---+
	2	|   |   |   |   |
		+---+---+---+---+
	3	|   |   |   |   |
		+---+---+---+---+
	|
	Y
	
Tiles are 32x32 pixels (or 24x24, parametrizable?)

**************************/
